﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Moving03.Administrator
{
    public partial class WebForm7 : System.Web.UI.Page
    {
        DataClasses1DataContext context = new DataClasses1DataContext();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (User.Identity.IsAuthenticated == false || User.Identity.IsAuthenticated == true && !User.IsInRole("Admin"))
            {
                Response.Redirect("../Default.aspx");
            }
        }

        protected void btnthem_Click(object sender, EventArgs e)
        {
            PhuongThucGoiHang ptgh = new PhuongThucGoiHang();
            ptgh.LoaiPhat = txtPt.Text;
            context.PhuongThucGoiHangs.InsertOnSubmit(ptgh);
            context.SubmitChanges();
            GridView1.DataBind();
            txtPt.Text = "";
        }

        protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
        {

        }

        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            RequiredFieldValidator1.Enabled = false;
        }

        protected void GridView1_RowDeleted(object sender, GridViewDeletedEventArgs e)
        {
            RequiredFieldValidator1.Enabled = true;
        }
    }
}